<!DOCTYPE html>
<html>
    <head>
        <title>DOM XPath Example</title>           
    </head>
    <body>
        <p>This example gets the first node matching the expression <code>employee/name</code>.</p>
        <script type="text/javascript">
            var xmldom = (new DOMParser()).parseFromString("<employees><employee title=\"Software Engineer\"><name>Nicholas C. Zakas</name></employee><employee title=\"Salesperson\"><name>Jim Smith</name></employee></employees>", "text/xml");
            var serializer = new XMLSerializer();
            var result = xmldom.evaluate("employee/name", xmldom.documentElement, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);

            if (result != null){
                alert(serializer.serializeToString(result.singleNodeValue));
            }
        </script>
 
 
    </body>
</html>
